home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #14
/
Monster Media No. 14 (April 1996) (Monster Media, Inc.).ISO
/
prog_bas
/
vbwarn.zip
/
FRMPER.FRM
< prev
next >
Wrap
Text File
|
1995-12-11
|
27KB
|
867 lines
VERSION 2.00
Begin Form FrmPer
BackColor = &H00C0C0C0&
BorderStyle = 3 'Fixed Double
Caption = "Persons"
ClientHeight = 2775
ClientLeft = 330
ClientTop = 3150
ClientWidth = 8955
Height = 3465
Left = 270
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2775
ScaleWidth = 8955
Top = 2520
Width = 9075
Begin SSFrame Frame3D1
ForeColor = &H00000000&
Height = 915
Left = 120
ShadowColor = 1 'Black
TabIndex = 46
Top = 1800
Width = 8715
Begin ComboBox cmbSortBy
BackColor = &H00C0C0C0&
Height = 300
Left = 780
TabIndex = 22
Top = 180
Width = 2955
End
Begin CommandButton cmdJumpTo
Caption = "Jump To:"
Height = 315
Left = 4020
TabIndex = 24
Top = 180
Width = 975
End
Begin TextBox txtJumpTo
BackColor = &H00C0C0C0&
Height = 285
Left = 5100
TabIndex = 23
Top = 180
Width = 3435
End
Begin CommandButton cmdCancel
BackColor = &H00004080&
Caption = "&Cancel"
Height = 315
Left = 7620
TabIndex = 19
Top = 540
Width = 915
End
Begin CommandButton cmdNew
BackColor = &H00C0C0C0&
Caption = "&New"
Height = 315
Left = 4020
TabIndex = 20
Top = 540
Width = 915
End
Begin CommandButton cmdSave
BackColor = &H00C0C0C0&
Caption = "&Save"
Height = 315
Left = 6420
TabIndex = 18
Top = 540
Width = 915
End
Begin CommandButton cmdDelete
BackColor = &H00C0C0C0&
Caption = "&Delete"
Height = 315
Left = 5220
TabIndex = 21
Top = 540
Width = 915
End
Begin Data dtaPerson
BackColor = &H00C0C0C0&
Caption = "Officers"
Connect = ""
DatabaseName = "vbwarn.mdb"
Exclusive = 0 'False
Height = 315
Left = 60
Options = 0
ReadOnly = 0 'False
RecordSource = "Person"
Top = 540
Width = 3675
End
Begin Label lblSortBy
BackColor = &H00C0C0C0&
Caption = "Sort By:"
Height = 195
Left = 60
TabIndex = 44
Top = 240
Width = 855
End
End
Begin CommandButton cmdReturn
Caption = "Return to Warning"
Height = 315
Left = 6960
TabIndex = 25
Top = 1440
Width = 1815
End
Begin TextBox txtSexP
BackColor = &H00C0C0C0&
DataField = "Sex"
DataSource = "dtaPerson"
Height = 285
Left = 8580
TabIndex = 11
Top = 780
Width = 255
End
Begin TextBox txtDOBP
BackColor = &H00C0C0C0&
DataField = "DOB"
DataSource = "dtaPerson"
Height = 315
Left = 7200
TabIndex = 10
Text = " "
Top = 780
Width = 915
End
Begin TextBox txtEyesP
BackColor = &H00C0C0C0&
DataField = "Eyes"
DataSource = "dtaPerson"
Height = 315
Left = 7200
TabIndex = 17
Top = 1080
Width = 735
End
Begin TextBox txtZipP
BackColor = &H00C0C0C0&
DataField = "Zip"
DataSource = "dtaPerson"
Height = 315
Left = 7200
TabIndex = 6
Top = 480
Width = 1095
End
Begin TextBox txtInchesP
BackColor = &H00C0C0C0&
DataField = "Inches"
DataSource = "dtaPerson"
Height = 315
Left = 1560
TabIndex = 13
Top = 1080
Width = 315
End
Begin TextBox txtFeetP
BackColor = &H00C0C0C0&
DataField = "Feet"
DataSource = "dtaPerson"
Height = 315
Left = 960
TabIndex = 12
Top = 1080
Width = 315
End
Begin TextBox txtDLP
BackColor = &H00C0C0C0&
DataField = "DL"
DataSource = "dtaPerson"
Height = 315
Left = 960
TabIndex = 7
Top = 780
Width = 1815
End
Begin TextBox txtAddressP
BackColor = &H00C0C0C0&
DataField = "Address"
DataSource = "dtaPerson"
Height = 315
Left = 960
TabIndex = 3
Top = 480
Width = 2235
End
Begin TextBox txtHairP
BackColor = &H00C0C0C0&
DataField = "Hair"
DataSource = "dtaPerson"
Height = 315
Left = 5760
TabIndex = 15
Top = 1080
Width = 795
End
Begin TextBox txtDLTypeP
BackColor = &H00C0C0C0&
DataField = "DLType"
DataSource = "dtaPerson"
Height = 315
Left = 5760
TabIndex = 9
Top = 780
Width = 795
End
Begin TextBox txtStateP
BackColor = &H00C0C0C0&
DataField = "State"
DataSource = "dtaPerson"
Height = 315
Left = 5760
TabIndex = 5
Top = 480
Width = 495
End
Begin TextBox txtWeightP
BackColor = &H00C0C0C0&
DataField = "Weight"
DataSource = "dtaPerson"
Height = 315
Left = 3720
TabIndex = 14
Top = 1080
Width = 615
End
Begin TextBox txtDLStP
BackColor = &H00C0C0C0&
DataField = "DLSt"
DataSource = "dtaPerson"
Height = 315
Left = 3720
TabIndex = 8
Top = 780
Width = 495
End
Begin TextBox txtCityP
BackColor = &H00C0C0C0&
DataField = "City"
DataSource = "dtaPerson"
Height = 315
Left = 3720
TabIndex = 4
Top = 480
Width = 1455
End
Begin TextBox txtInitialP
BackColor = &H00C0C0C0&
DataField = "Initial"
DataSource = "dtaPerson"
Height = 315
Left = 7200
TabIndex = 2
Top = 180
Width = 615
End
Begin TextBox txtLNameP
BackColor = &H00C0C0C0&
DataField = "LName"
DataSource = "dtaPerson"
Height = 315
Left = 3720
TabIndex = 0
Top = 180
Width = 1455
End
Begin TextBox txtFNameP
BackColor = &H00C0C0C0&
DataField = "FName"
DataSource = "dtaPerson"
Height = 315
Left = 5760
TabIndex = 1
Top = 180
Width = 1035
End
Begin Label Label1
BackColor = &H00C0C0C0&
Caption = "Persons"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 13.5
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 315
Left = 120
TabIndex = 47
Top = 60
Width = 1275
End
Begin Label lblID
BackColor = &H00E0FFFF&
BorderStyle = 1 'Fixed Single
DataField = "ID"
DataSource = "dtaPerson"
Height = 315
Left = 2460
TabIndex = 45
Top = 180
Width = 735
End
Begin Label Label30
BackColor = &H00C0C0C0&
Caption = "Eyes:"
Height = 255
Left = 6660
TabIndex = 16
Top = 1080
Width = 555
End
Begin Label Label29
BackColor = &H00C0C0C0&
Caption = "Hair:"
Height = 255
Left = 5280
TabIndex = 26
Top = 1080
Width = 495
End
Begin Label Label28
BackColor = &H00C0C0C0&
Caption = "Weight:"
Height = 255
Left = 3060
TabIndex = 27
Top = 1080
Width = 735
End
Begin Label Label27
BackColor = &H00C0C0C0&
Caption = "''"
Height = 315
Left = 1920
TabIndex = 28
Top = 1080
Width = 195
End
Begin Label Label26
BackColor = &H00C0C0C0&
Caption = "'"
Height = 255
Left = 1440
TabIndex = 29
Top = 1080
Width = 135
End
Begin Label Label25
BackColor = &H00C0C0C0&
Caption = "Height:"
Height = 255
Left = 300
TabIndex = 30
Top = 1080
Width = 615
End
Begin Label Label24
BackColor = &H00C0C0C0&
Caption = "Sex:"
Height = 255
Left = 8160
TabIndex = 31
Top = 780
Width = 435
End
Begin Label Label23
BackColor = &H00C0C0C0&
Caption = "DOB:"
Height = 255
Left = 6720
TabIndex = 32
Top = 780
Width = 495
End
Begin Label Label22
BackColor = &H00C0C0C0&
Caption = "Type:"
Height = 255
Left = 5220
TabIndex = 33
Top = 780
Width = 555
End
Begin Label Label21
BackColor = &H00C0C0C0&
Caption = "State:"
Height = 255
Left = 3180
TabIndex = 34
Top = 780
Width = 555
End
Begin Label Label20
BackColor = &H00C0C0C0&
Caption = "DL#:"
Height = 255
Left = 480
TabIndex = 35
Top = 780
Width = 495
End
Begin Label Label19
BackColor = &H00C0C0C0&
Caption = "Zip:"
Height = 255
Left = 6840
TabIndex = 36
Top = 480
Width = 435
End
Begin Label Label18
BackColor = &H00C0C0C0&
Caption = "State:"
Height = 255
Left = 5220
TabIndex = 37
Top = 480
Width = 555
End
Begin Label Label17
BackColor = &H00C0C0C0&
Caption = "City:"
Height = 255
Left = 3300
TabIndex = 38
Top = 480
Width = 495
End
Begin Label Label16
BackColor = &H00C0C0C0&
Caption = "Address:"
Height = 255
Left = 180
TabIndex = 39
Top = 480
Width = 795
End
Begin Label Label15
BackColor = &H00C0C0C0&
Caption = "Init:"
Height = 255
Left = 6840
TabIndex = 40
Top = 180
Width = 375
End
Begin Label Label14
BackColor = &H00C0C0C0&
Caption = "First:"
Height = 255
Left = 5280
TabIndex = 41
Top = 180
Width = 495
End
Begin Label Label3
BackColor = &H00C0C0C0&
Caption = "ID:"
Height = 255
Left = 2100
TabIndex = 42
Top = 180
Width = 315
End
Begin Label Label5
BackColor = &H00C0C0C0&
Caption = "Last:"
Height = 255
Left = 3240
TabIndex = 43
Top = 180
Width = 495
End
Begin Menu mnuRecord
Caption = "&Record"
Begin Menu mnuNew
Caption = "&New"
End
Begin Menu mnuDelete
Caption = "&Delete"
End
Begin Menu mnuSave
Caption = "&Save"
End
Begin Menu mnuCancel
Caption = "&Cancel"
End
Begin Menu dash
Caption = "-"
End
Begin Menu mnuExit
Caption = "E&xit"
End
End
Begin Menu mnuHelp
Caption = "&Help"
End
End
Option Explicit
Dim CurrRec As Integer
Dim Starting As Integer
Dim LastNum As Integer
Dim PSort As Integer
Sub cmbSortBy_Click ()
If cmbSortBy.Text = "ID Number" Then dtaPerson.RecordSource = QPerson & "ORDER BY ID"
If cmbSortBy.Text = "Last Name" Then dtaPerson.RecordSource = QPerson & "ORDER BY LName"
If cmbSortBy.Text = "First Name" Then dtaPerson.RecordSource = QPerson & "ORDER BY FName"
If cmbSortBy.Text = "Address" Then dtaPerson.RecordSource = QPerson & "ORDER BY Address"
If cmbSortBy.Text = "City" Then dtaPerson.RecordSource = QPerson & "ORDER BY City"
If cmbSortBy.Text = "State" Then dtaPerson.RecordSource = QPerson & "ORDER BY State"
If cmbSortBy.Text = "Zip Code" Then dtaPerson.RecordSource = QPerson & "ORDER BY Zip"
If cmbSortBy.Text = "Driver's Lic" Then dtaPerson.RecordSource = QPerson & "ORDER BY DL"
If cmbSortBy.Text = "DL State" Then dtaPerson.RecordSource = QPerson & "ORDER BY DLSt"
If cmbSortBy.Text = "Date Of Birth" Then dtaPerson.RecordSource = QPerson & "ORDER BY DOB"
If cmbSortBy.Text = "Sex" Then dtaPerson.RecordSource = QPerson & "ORDER BY Sex"
If cmbSortBy.Text = "Height" Then dtaPerson.RecordSource = QPerson & "ORDER BY Feet,Inches"
If cmbSortBy.Text = "Weight" Then dtaPerson.RecordSource = QPerson & "ORDER BY Weight"
If cmbSortBy.Text = "Hair Color" Then dtaPerson.RecordSource = QPerson & "ORDER BY Hair"
If cmbSortBy.Text = "Eye Color" Then dtaPerson.RecordSource = QPerson & "ORDER BY Eyes"
dtaPerson.Refresh
End Sub
Sub cmdCancel_Click ()
If LastNum <> 0 Then
dtaPerson.Recordset.FindFirst "ID = " & LastNum
Call NoChange
Else
cmdNew.Value = True
End If
End Sub
Sub cmdDel_Click ()
dtaPerson.Recordset.Delete
dtaPerson.Refresh
If dtaPerson.Recordset.EOF Then cmdNew.Value = True
End Sub
Sub cmdDelete_Click ()
On Error GoTo CheckRefInt
dtaPerson.Recordset.Delete
dtaPerson.Refresh
If dtaPerson.Recordset.EOF Then cmdNew.Value = True
Exit Sub
CheckRefInt:
If Err = 3200 Then
MsgBox "Person has at least one ticket, cannot delete", MB_EXCL, "Warning Ticket"
Exit Sub
Else
MsgBox "Unexpected Error " & "'" & Err & "'", MB_EXCL, "Warning Ticket"
Exit Sub
End If
Resume
End Sub
Sub cmdJumpTo_Click ()
CurrRec = dtaPerson.Recordset!ID
Dim Feet, Inches
If cmbSortBy.Text = "ID Number" Then dtaPerson.Recordset.FindFirst "ID >= " & txtJumpTo
If cmbSortBy.Text = "Last Name" Then dtaPerson.Recordset.FindFirst "FName >= " & "'" & txtJumpTo & "'"
If cmbSortBy.Text = "First Name" Then dtaPerson.Recordset.FindFirst "LName >= " & "'" & txtJumpTo & "'"
If cmbSortBy.Text = "Address" Then dtaPerson.Recordset.FindFirst "Address >= " & "'" & txtJumpTo & "'"
If cmbSortBy.Text = "City" Then dtaPerson.Recordset.FindFirst "City >= " & "'" & txtJumpTo & "'"
If cmbSortBy.Text = "State" Then dtaPerson.Recordset.FindFirst "State >= " & "'" & txtJumpTo & "'"
If cmbSortBy.Text = "Zip Code" Then dtaPerson.Recordset.FindFirst "Zip >= " & "'" & txtJumpTo & "'"
If cmbSortBy.Text = "Driver's Lic" Then dtaPerson.Recordset.FindFirst "DL >= " & "'" & txtJumpTo & "'"
If cmbSortBy.Text = "DL State" Then dtaPerson.Recordset.FindFirst "DLSt >= " & "'" & txtJumpTo & "'"
If cmbSortBy.Text = "Date Of Birth" Then dtaPerson.Recordset.FindFirst "DOB >= " & "#" & txtJumpTo & "#"
If cmbSortBy.Text = "Sex" Then dtaPerson.Recordset.FindFirst "Sex >= " & "'" & txtJumpTo & "'"
If cmbSortBy.Text = "Height" Then
Feet = Left(txtJumpTo, (InStr(1, txtJumpTo, " ") - 1))
Inches = Right(txtJumpTo, Len(txtJumpTo) - InStr(1, txtJumpTo, " "))
dtaPerson.Recordset.FindFirst "(Feet >= " & "'" & Feet & "') AND (Inches >= '" & Inches & "')"
End If
If cmbSortBy.Text = "Weight" Then dtaPerson.Recordset.FindFirst "Weight >= " & "'" & txtJumpTo & "'"
If cmbSortBy.Text = "Hair Color" Then dtaPerson.Recordset.FindFirst "Hair >= " & "'" & txtJumpTo & "'"
If cmbSortBy.Text = "Eye Color" Then dtaPerson.Recordset.FindFirst "Eyes >= " & "'" & txtJumpTo & "'"
If dtaPerson.Recordset.NoMatch Then
MsgBox "No records found that match that value.", MB_EXCL, "Warning Ticket"
dtaPerson.Refresh
dtaPerson.Recordset.FindFirst "ID = " & CurrRec
End If
End Sub
Sub cmdNew_Click ()
Call Editing
dtaPerson.Recordset.AddNew
txtLNameP.SetFocus
End Sub
Sub cmdReturn_Click ()
Unload frmPer
End Sub
Sub cmdSave_Click ()
On Error GoTo CheckLenErr
If txtLNameP <> "" And txtFNameP <> "" Then
If MsgBox("Commit Changes?", MSGBOX_TYPE) = YES Then
If dtaPerson.EditMode = EM_ADDNEW Then
dtaPerson.Recordset.Update
dtaPerson.Recordset.MoveLast
CurrRec = dtaPerson.Recordset!ID
dtaPerson.Refresh
dtaPerson.Recordset.FindFirst "ID = " & CurrRec
Else
dtaPerson.Recordset.Update
CurrRec = dtaPerson.Recordset!ID
dtaPerson.Refresh
dtaPerson.Recordset.FindFirst "ID =" & CurrRec
End If
Call NoChange
End If
Else
MsgBox "Must have first and last name to save", MB_EXCL, "Warning Ticket"
End If
Exit Sub
CheckLenErr:
Select Case Err
Case 3163
MsgBox "A value is too long, fix or cancel save", MB_EXCL, "Warning Ticket"
Exit Sub
Case 3164
MsgBox "This record has been deleted by another user", MB_EXCL, "Warning Ticket"
dtaPerson.Refresh
If dtaPerson.Recordset.EOF Then
MsgBox "There are no persons entered, you may add one now.", MB_EXCL, "Warning Ticket"
cmdNew.Value = True
Else
Call NoChange
End If
Exit Sub
Case Else
MsgBox "Unexpected Error " & Str(Err) & " " & Error, MB_EXCL, "Warning Ticket"
Exit Sub
End Select
Resume
End Sub
Sub dtaPerson_Reposition ()
If (Not Starting) And (dtaPerson.EditMode <> EM_ADDNEW) Then
If Not dtaPerson.Recordset.EOF Then
LastNum = dtaPerson.Recordset!ID
Else
LastNum = 0
End If
End If
End Sub
Sub dtaPerson_Validate (Action As Integer, Save As Integer)
Select Case Action
Case 1 ' First
Case 2 ' Previous
Case 3 ' Next
Case 4 ' Last
Case 5 ' AddNew
Save = False
Case 6 ' Update
Case 7 ' Delete
If MsgBox("Delete Record?", MSGBOX_TYPE) <> YES Then Action = 0
Case 8 ' Find
Save = False
Case 9 ' Set Bookmark
Case 10 ' Close
Case 11 ' Unload Form
If (dtaPerson.Enabled = False) Then
If MsgBox("Commit Changes?", MSGBOX_TYPE) = YES Then
If Not (txtLNameP <> "" And txtFNameP <> "") Then
MsgBox "Must have first and last name to save", MB_EXCL, "Warning Ticket"
Action = 0
End If
Else
Save = False
End If
End If
End Select
End Sub
Sub Editing ()
If dtaPerson.Enabled = True Then
dtaPerson.Enabled = False
mnuSave.Enabled = True
mnuCancel.Enabled = True
mnuNew.Enabled = False
mnuDelete.Enabled = False
cmbSortBy.Enabled = False
cmdJumpTo.Enabled = False
cmdSave.Enabled = True
cmdCancel.Enabled = True
cmdNew.Enabled = False
cmdDelete.Enabled = False
lblSortBy.ForeColor = &H808080
End If
End Sub
Sub Form_Activate ()
If Starting Then
Call RedoCombo
Starting = False
dtaPerson.RecordSource = QPerson & " ORDER BY Person.ID"
PSort = 1
dtaPerson.Caption = "Persons by ID"
cmbSortBy.Text = "ID Number"
dtaPerson.Refresh
If dtaPerson.Recordset.EOF Then
cmdNew.Value = True
Else
Call NoChange
End If
End If
End Sub
Sub Form_Load ()
NL = (Chr(13) + Chr(10))
Starting = True
End Sub
Sub mnuCancel_Click ()
cmdCancel.Value = True
End Sub
Sub mnuDelete_Click ()
cmdDelete.Value = True
End Sub
Sub mnuExit_Click ()
Unload frmPer
End Sub
Sub mnuNew_Click ()
cmdNew.Value = True
End Sub
Sub mnuSave_Click ()
cmdSave.Value = True
End Sub
Sub NoChange ()
lblSortBy.ForeColor = &H80000008
dtaPerson.Enabled = True
mnuSave.Enabled = False
mnuCancel.Enabled = False
mnuNew.Enabled = True
mnuDelete.Enabled = True
cmbSortBy.Enabled = True
cmdJumpTo.Enabled = True
cmdSave.Enabled = False
cmdCancel.Enabled = False
cmdNew.Enabled = True
cmdDelete.Enabled = True
End Sub
Sub RedoCombo ()
cmbSortBy.AddItem "ID Number"
cmbSortBy.AddItem "Last Name"
cmbSortBy.AddItem "First Name"
cmbSortBy.AddItem "Address"
cmbSortBy.AddItem "City"
cmbSortBy.AddItem "State"
cmbSortBy.AddItem "Zip Code"
cmbSortBy.AddItem "Driver's Lic"
cmbSortBy.AddItem "DL State"
cmbSortBy.AddItem "Date Of Birth"
cmbSortBy.AddItem "Sex"
cmbSortBy.AddItem "Height"
cmbSortBy.AddItem "Weight"
cmbSortBy.AddItem "Hair Color"
cmbSortBy.AddItem "Eye Color"
End Sub
Sub txtAddressP_KeyPress (KeyAscii As Integer)
Call Editing
End Sub
Sub txtCityP_KeyPress (KeyAscii As Integer)
Call Editing
End Sub
Sub txtDLP_KeyPress (KeyAscii As Integer)
Call Editing
End Sub
Sub txtDLStP_KeyPress (KeyAscii As Integer)
If (KeyAscii >= Asc("a")) And (KeyAscii <= Asc("z")) Then KeyAscii = KeyAscii - 32
Call Editing
End Sub
Sub txtDLTypeP_KeyPress (KeyAscii As Integer)
If (KeyAscii >= Asc("a")) And (KeyAscii <= Asc("z")) Then KeyAscii = KeyAscii - 32
Call Editing
End Sub
Sub txtDOBP_KeyPress (KeyAscii As Integer)
Call Editing
End Sub
Sub txtDOBP_LostFocus ()
If (Not IsDate(txtDOBP.Text)) And (txtDOBP <> "") Then
MsgBox ("Enter a valid date"), MB_EXCL, "Warning Ticket"
txtDOBP.SetFocus
End If
End Sub
Sub txtEyesP_KeyPress (KeyAscii As Integer)
Call Editing
End Sub
Sub txtFeetP_KeyPress (KeyAscii As Integer)
Call Editing
End Sub
Sub txtFNameP_KeyPress (KeyAscii As Integer)
Call Editing
End Sub
Sub txtHairP_KeyPress (KeyAscii As Integer)
Call Editing
End Sub
Sub txtIDP_KeyPress (KeyAscii As Integer)
Call Editing
End Sub
Sub txtInchesP_KeyPress (KeyAscii As Integer)
Call Editing
End Sub
Sub txtInitialP_KeyPress (KeyAscii As Integer)
Call Editing
End Sub
Sub txtLNameP_KeyPress (KeyAscii As Integer)
Call Editing
End Sub
Sub txtSexP_KeyPress (KeyAscii As Integer)
If (KeyAscii >= Asc("a")) And (KeyAscii <= Asc("z")) Then KeyAscii = KeyAscii - 32
Call Editing
End Sub
Sub txtStateP_KeyPress (KeyAscii As Integer)
If (KeyAscii >= Asc("a")) And (KeyAscii <= Asc("z")) Then KeyAscii = KeyAscii - 32
Call Editing
End Sub
Sub txtWeightP_KeyPress (KeyAscii As Integer)
Call Editing
End Sub
Sub txtZipP_KeyPress (KeyAscii As Integer)
Call Editing
End Sub